<template>
  <div :class="['avue-logo',{'isActive':nowTagValue=='/wel/index'}]" @click="goto">
    <i class="myfont icon-home"></i>
    <span>
      首页
    </span>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
import {isURL} from "@/util/validate";
export default {
  name: "logo",
  data() {
    return {
    };
  },
  created() {

  },

  computed: {
    ...mapGetters(["website", "keyCollapse","tag","menu"]),
    nowTagValue: function () {
      return this.$router.$avueRouter.getValue(this.$route);
    }
  },
  methods: {
    goto(){
      this.$store.commit('SET_CURRENT_SIDE','/wel/index')
      let tag =this.website.fistPage
      if (this.screen <= 1) this.$store.commit("SET_COLLAPSE");
      if (this.validIsOpen(tag)) {
        window.open(tag[this.pathKey]);
      } else {
        this.$router.$avueRouter.group = tag.group;
        this.$router.$avueRouter.meta = tag.meta;
        this.$router.push({
          path: this.$router.$avueRouter.getPath({
            name: tag.label,
            src: tag.value
          }, tag.meta),
          query: tag.query
        });
      }
      let list=[]
      this.menu.forEach(item=>{list.push(...item.children)})
      this.$store.commit("SET_TAB_LIST",list);
    },
    validIsOpen(item) {
      if (item[this.isOpenKey] === 2 && isURL(item[this.pathKey])) {
        return true;
      }
    },
  }
};
</script>

<style lang="scss">
.fade-leave-active {
  transition: opacity 0.2s;
}
.fade-enter-active {
  transition: opacity 2.5s;
}
.fade-enter,
.fade-leave-to {
  opacity: 0;
}
.avue-logo {
  position: fixed;
  top: 0;
  left: 0;
  width: 64px;
  height: 70px;
  line-height: 64px;
  background-color: #fff;
  font-size: 20px;
  overflow: hidden;
  box-sizing: border-box;
  /*box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15);*/
  color: #11212F;
  z-index: 1024;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 10px 0 6px;
  &:hover{
    i,span{
      color: #1c7df0 ;
    }
  }
  i{
    font-size: 30px;
    color: #999;
    height: 30px;
    line-height: 30px;
  }
  span{
    font-size: 13px;text-align: center;line-height: 30px;
  }

  &_title {
    display: block;
    text-align: center;
    font-weight: 300;
    font-size: 20px;
  }
  &_subtitle {
    display: block;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
  }
}
.isActive{
  i,span{
    color: #1c7df0;
  }
}
</style>
